<template>
  <a-modal
      :title="title || '审核不通过理由'"
      :visible="showReason"
      @ok="confirm(true)"
      @cancel="confirm(false)">
      <a-textarea :autosize="{ minRows: 2 }" style="resize:none;" v-model="reasonContent" ref="textarea"/>
    </a-modal>
</template>
<script>
export default {
  name: 'checkedReason',
  props: {
    showReason: {
      type: Boolean,
      require: false
    },
    title: {
      type: String,
      require: false
    }
  },
  data () {
    return {
      reasonContent: ''
    }
  },
  watch: {
    showReason (val) {
      if (val) {
        this.reasonContent = ''
      }
    }
  },
  methods: {
    confirm (flag) {
      this.$emit('confirm', { reasonContent: this.reasonContent, flag })
    }
  }
}
</script>
